#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n;
int q[N];

int main() {
	vector<int> hash;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> q[i];
	}
	for (int i = 0; i < n; ++i) {
		int l = i, r = i;
		int ans = 1e9;
		while (l >= 0 && q[l] != 0) {
			--l;
		}
		while (r < n && q[r] != 0) {
			++r;
		}
		if (l >= 0 && q[l] == 0) {
			ans = min(ans, abs(l - i));
		}
		if (r < n && q[r] == 0) {
			ans = min(ans, abs(r - i));
		}
		hash.push_back(ans);
	}
	for (int t : hash) {
		cout << t << ' ';
	}
	return 0;
}